package com.story.modular.app.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.story.common.persistence.dao.CategoryDao;
import com.story.common.persistence.model.CategoryEntity;
import com.story.modular.app.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


/**
 * Service实现类
 *
 * @author wangjj
 * @email 987995507@qq.com
 * @date 2019-12-27 11:44:35
 */
@Service("categoryService")
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryDao categoryDao;

    @Override
    public CategoryEntity queryObject(Integer id) {
        return categoryDao.selectById(id);
    }

    @Override
    public List<CategoryEntity> queryList(Map<String, Object> map) {
        return categoryDao.selectByMap(map);
    }

    @Override
    public List<CategoryEntity> queryPageList(Page<CategoryEntity> page, String name) {
        return categoryDao.queryPageList(page,name);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return 0;
    }

    @Override
    public int save(CategoryEntity category) {
        return categoryDao.insert(category);
    }

    @Override
    public int update(CategoryEntity category) {
        return categoryDao.updateById(category);
    }

    @Override
    public int delete(Integer id) {
        return categoryDao.deleteById(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        return 0;
    }
}
